#ifndef SBCONSTANTS_H_INCLUDED
#define SBCONSTANTS_H_INCLUDED

#define TIME_STEP (0.010f)
#define SHIP_MASS (5.f)
#define SHIP_SIZE (12.f)

namespace MESSAGE
{
	// The first 4 bits are the message group.
	const sf::Uint8 GROUP_BITS 		= 0xF0;

	// The next 4 bits are the details refining the message type.
	const sf::Uint8 DETAILS_BITS 		= 0x0F;

	namespace TYPE
	{
		const sf::Uint8 CONNECT       = 0x10;
		const sf::Uint8 WORLD_UPDATE  = 0x20;
		const sf::Uint8 ADMIN         = 0x30;
	}

	namespace CONNECT
	{
		const sf::Uint8 CONNECT       = 0x01;
		const sf::Uint8 SYNCRONIZING  = 0x02;
		const sf::Uint8 SYNCRONIZED   = 0x03;
		const sf::Uint8 DISCONNECT    = 0x04;
	}

	namespace WORLD_UPDATE
	{
		// Type field, use logical && with CLASS_FIELD to extract and compare.
		const sf::Uint8 CREATE_OBJ    = 0x01;
		const sf::Uint8 DESTROY_OBJ   = 0x02;
		const sf::Uint8 SHIP_CONTROL  = 0x03;
		const sf::Uint8 CONFIRMED  	= 0x04;
	}

	namespace ADMIN
	{
		const sf::Uint8 RESTART 		= 0x01;
		const sf::Uint8 SHUTDOWN 		= 0x02;
		const sf::Uint8 KICK 			= 0x03;
		const sf::Uint8 ETC 				= 0x04;
	}
}

// Bitfield definitions
namespace SHIP_CONTROL
{
	const sf::Int8 LEFT 				= 1 << 0;
	const sf::Int8 RIGHT				= 1 << 1;
	const sf::Int8 FORWARD 			= 1 << 2;
	const sf::Int8 FIRE 				= 1 << 3;
}

const unsigned short SERVER_DEFAULT_PORT = 1024;

#endif // SBCONSTANTS_H_INCLUDED
